<?php

namespace App\Http\Controllers;

use App\Helper\ApiResponseHelper;
use App\Helper\SmsCode;
use App\Models\Member;
use Illuminate\Http\Request;

class SmsController extends Controller
{
    public function member(Request $request, SmsCode $smsCode)
    {
        if (empty($request->telephone)) {
            return ApiResponseHelper::json([], 400, '请输入手机号');
        }

        try {
            $smsCode->send($request->telephone);
        } catch (\Exception $exception) {
            return ApiResponseHelper::json([], 400, $exception->getMessage());
        }

        return ApiResponseHelper::json([]);
    }
}
